//
//  YJBaseViewController.m
//  SnackCourier
//
//  Created by qianfeng01 on 15/7/17.
//  Copyright (c) 2015年 qianfeng01. All rights reserved.
//

#import "YJBaseViewController.h"

@interface YJBaseViewController ()

@end

@implementation YJBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

-(void)createTableView:(NSString*)cellName{
    CGRect frame =self.view.bounds;
    self.tableView =[[UITableView alloc] initWithFrame:frame style:UITableViewStylePlain];
    self.tableView.delegate =self;
    self.tableView.dataSource=self;
    
    [self.tableView registerNib:[UINib nibWithNibName:cellName bundle:nil] forCellReuseIdentifier:cellName];
    [self.view addSubview:self.tableView];
    
}

-(void)createHttpRequest{
    //不让af自动解析
    self.manager =[AFHTTPRequestOperationManager manager];
    self.manager.responseSerializer =[AFHTTPResponseSerializer serializer];
}

-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    return nil;
}


-(void)createNavigationItem{
    self.title =@"详情";
    [self.navigationItem setHidesBackButton:YES];
    UIBarButtonItem *rightItem =[[UIBarButtonItem alloc] initWithTitle:@"" style:(UIBarButtonItemStylePlain) target:self action:@selector(rightClick)];
    [rightItem setImage:[[UIImage imageNamed:@"shareIcon"] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)]];
    self.navigationItem.rightBarButtonItem =rightItem;
    
    UIBarButtonItem *leftItme =[[UIBarButtonItem alloc] initWithTitle:@"" style:(UIBarButtonItemStylePlain) target:self action:@selector(leftClick)];
    [leftItme setImage:[[UIImage imageNamed:@"backIcon"] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)]];
    self.navigationItem.leftBarButtonItem =leftItme;
    
}

-(void)rightClick{
    [UMSocialSnsService presentSnsIconSheetView:self appKey:@"55ada28f67e58ef8c00054cc" shareText:@"零食工厂" shareImage:[UIImage imageNamed:@""] shareToSnsNames:@[UMShareToEmail,UMShareToSms,UMShareToSina,UMShareToRenren] delegate:self];
}
-(void)leftClick{
    [self.navigationController popViewControllerAnimated:YES];
}


@end
